package com.kkd.tool;

import java.util.Collections;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.OutputFile;

public class FastAutoGeneratorMain {
	
	private static final String JDBC_URL = "jdbc:mysql://mysql57.st.iblidc.com:3306/SK_KuKeDuoExternalService?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai";
	private static final String USERNAME = "user_kkd";
	private static final String PASSWORD = "kkdsit.2021";
	/**
     * 数据源配置
     */
    private static final DataSourceConfig.Builder DATA_SOURCE_CONFIG = new DataSourceConfig.Builder(JDBC_URL, USERNAME, PASSWORD);

	public static void main(String[] args) {
		String projectPath = System.getProperty("user.dir");
		FastAutoGenerator.create(DATA_SOURCE_CONFIG)
							.globalConfig(builder -> {
								builder.author("yancy")
										//.enableSwagger()
										.fileOverride()
										.disableOpenDir()
										.outputDir(projectPath + "/src/main/java");
							})
							.packageConfig(builder -> {
								builder.parent("com.kkd.bl")
										.mapper("repository")
										//.moduleName("system")
								.pathInfo(Collections.singletonMap(OutputFile.mapperXml, projectPath + "/src/main/resources/repository"));
							})
							.templateConfig(builder -> {
								builder.controller("") // 禁止生成controller代码
										.service("") // 禁止生成service代码
										.serviceImpl("");
							})
							.strategyConfig(builder -> {
								builder.addInclude("alipayaddminiapprecord","alipaycontractedproducts",
										"alipayminiappauthinfo",
										"alipayminiappauthrecord",
										"alipaymsgnotice",
										"alipaynotify",
										"alipayordersextend",
										"alipaytrade",
										"alipayvendorcategory",
										"alipayvendorcategoryextend",
										"dadabussinesscodeinfo",
										"applicationcredential",
										"dadadistrictcodeinfo",
										"expressordercallbackinfo",
										"externalorder",
										"externalordernodifyrecord",
										"livegood",
										"liveroominfo",
										"printerbussinessauthorcallbackinfo",
										"printerrequestlog",
										"productmapping",
										"sendsmsrecord",
										"supplierconfig",
										"supplierprinter",
										"suppliershortmessage",
										"wechatopenplatformconfig",
										"wxbank",
										"wxcertificate",
										"wxenterpriseapplicationconfig",
										"wxenterpriseauthinfo",
										"wxenterpriseauthrecord",
										"wxenterpriseinfo",
										"wxenterprisereceivemessage",
										"wxenterprisereceiveticket",
										"wxrefund",
										"wxrsapublicsecretkey",
										"wxselfenterpriseapplicationconfig",
										"wxthirdplatformauthinfo",
										"wxthirdplatformauthinfoforbussinsess",
										"wxthirdplatformauthstatusrecord",
										"wxthirdplatformbusscreateminiapprecord",
										"wxthirdplatformpreauthinfo"






								);
								builder.entityBuilder()
										.enableRemoveIsPrefix()
										.enableLombok()
										.enableTableFieldAnnotation();
								builder.mapperBuilder()
										.enableMapperAnnotation();
							})
							.execute();
	}
	
}
